//****************************************************************
//  PairOfDice.java    Author: Tang Caiming
//
//  摇两个骰子.
//****************************************************************
public class PairOfDice 
{
    private final int MAX = 6; // 最大面值
    private Die die1, die2; // 两个骰子
    private int faceValue1, faceValue2; // 两个骰子的面值
    private int sum12;
    // 构造函数，设置初始值
    public PairOfDice()
    {
        die1 = new Die();
        die2 = new Die();
    }

    // 滚动骰子并返回结果
    public int proll()
    {
        faceValue1 = die1.roll();
        faceValue2 = die2.roll();
        return faceValue1 + faceValue2;
    }

    public void setFaceValue1(int faceValue1)
    {
        this.faceValue1 = faceValue1;
    }

    public int getFaceValue1()
    {
        return this.faceValue1;
    }

    public void setFaceValue2(int faceValue2)
    {
        this.faceValue2 = faceValue2;
    }

    public int getFaceValue2()
    {
        return this.faceValue2;
    }

    public int sum12()
    {
        sum12 = faceValue1 + faceValue2;
        return sum12;
    }

    public String toString()
    {
        return  "第一个骰子值为: " + faceValue1 + "\n" +
                "第二个骰子值为: " + faceValue2 + "\n" +
                "两个面值之和: " + sum12();
    }

}
